package com.hyacinth.serialize;

/**
 * 序列化算法枚举
 * @author zhangfb
 * @version 1.0.0.1
 * @since JDK 1.8
 */
public enum SerializerAlgorithm {
    JAVA((byte) 1),
    JSON((byte) 2),
    KRYO((byte) 3),
    FST((byte) 4),
    PROTOSTUFF((byte) 5);

    private byte value;

    SerializerAlgorithm(byte value) {
        this.value = value;
    }

    public static SerializerAlgorithm valueOf(byte value) {
        switch(value) {
            case 1:
                return JAVA;
            case 2:
                return JSON;
            case 3:
                return KRYO;
            case 4:
                return FST;
            case 5:
                return PROTOSTUFF;
            default:
                return null;
        }
    }

    public byte value() {
        return this.value;
    }
}
